home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb14.zip / SIGF.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-17  |  3KB  |  63 lines

  1. (*-------------------------------------------------------------------------*)
  2. (*                 SigF  -- Significance of F distribution                 *)
  3. (*-------------------------------------------------------------------------*)
  4.  
  5. FUNCTION SigF( F , Dfn , Dfd : REAL ) : REAL;
  6.  
  7. (*-------------------------------------------------------------------------*)
  8. (*                                                                         *)
  9. (*       Function:  SigF                                                   *)
  10. (*                                                                         *)
  11. (*       Purpose:   Evaluates F distribution probability                   *)
  12. (*                                                                         *)
  13. (*       Calling Sequence:                                                 *)
  14. (*                                                                         *)
  15. (*            P     := SigF( F , Dfn , Dfd );                              *)
  16. (*                                                                         *)
  17. (*                 F      --- F-value                                      *)
  18. (*                 Dfn    --- Numerator degrees of freedom                 *)
  19. (*                 Dfd    --- Denominator degrees of freedom               *)
  20. (*                                                                         *)
  21. (*                 P      --- Resultant probability                        *)
  22. (*                                                                         *)
  23. (*       Calls:                                                            *)
  24. (*                                                                         *)
  25. (*            CdBeta                                                       *)
  26. (*                                                                         *)
  27. (*       Method:                                                           *)
  28. (*                                                                         *)
  29. (*            The input values are transformed to match the                *)
  30. (*            requirements of the Beta distribution.  Function CDBeta      *)
  31. (*            provides the corresponding cumulative Beta distribution      *)
  32. (*            probability.                                                 *)
  33. (*                                                                         *)
  34. (*            An error in the input arguments results in a returned        *)
  35. (*            probability of -1.                                           *)
  36. (*                                                                         *)
  37. (*-------------------------------------------------------------------------*)
  38.  
  39. CONST
  40.    Dprec   = 12;
  41.    MaxIter = 200;
  42.  
  43. VAR
  44.    Iter:   INTEGER;
  45.    Cprec:  REAL;
  46.    Ifault: INTEGER;
  47.    Pval:   REAL;
  48.  
  49. BEGIN (* SigF *)
  50.  
  51.    Pval := -1.0;
  52.  
  53.    IF ( Dfn > 0.0 ) AND ( Dfd > 0.0 ) THEN
  54.       BEGIN
  55.          Pval := CDBeta( Dfd / ( Dfd + F * Dfn ), Dfd / 2.0, Dfn / 2.0,
  56.                          Dprec, MaxIter, Cprec, Iter, Ifault );
  57.          IF Ifault <> 0 THEN Pval := -1.0;
  58.       END;
  59.  
  60.    SigF := Pval;
  61.  
  62. END   (* SigF *);
  63.